from fastapi import APIRouter, Depends
from sqlalchemy.ext.asyncio import AsyncSession
from extensions.db.mysql import get_async_session
from ..model import User

user_roters = APIRouter()


@user_roters.post("/test")
async def add_role(session: AsyncSession = Depends(get_async_session)):
    async with session.begin():
        session.add_all([
            User(username="user1", email="user1", hashed_password="123456"),
            User(username="user2", email="user2", hashed_password="123456"),
            User(username="user3", email="user3", hashed_password="123456"),
        ])
    await session.commit()
    return {"msg": "ok"}
